package org.msfj.admin.model;

import org.msfj.common.base.BaseModel;

import javax.persistence.Column;
import javax.persistence.Table;
import java.io.Serializable;

@Table(name = "admin_metadata")
public class Metadata extends BaseModel implements Serializable {
    /**
     * 元数据分类
     */
    @Column(name = "type_id")
    private String typeId;

    private String type;

    /**
     * 元数据名称
     */
    private String label;

    /**
     * 元数据英文名称
     */
    private String ename;

    private String placeholder;

    /**
     * 元数据选项
     */
    private String options;

    /**
     * 验证规则
     */
    @Column(name = "validate_rules")
    private String validateRules;



    /**
     * 获取元数据分类
     *
     * @return type_id - 元数据分类
     */
    public String getTypeId() {
        return typeId;
    }

    /**
     * 设置元数据分类
     *
     * @param typeId 元数据分类
     */
    public void setTypeId(String typeId) {
        this.typeId = typeId;
    }

    /**
     * @return type
     */
    public String getType() {
        return type;
    }

    /**
     * @param type
     */
    public void setType(String type) {
        this.type = type == null ? null : type.trim();
    }

    /**
     * 获取元数据名称
     *
     * @return label - 元数据名称
     */
    public String getLabel() {
        return label;
    }

    /**
     * 设置元数据名称
     *
     * @param label 元数据名称
     */
    public void setLabel(String label) {
        this.label = label == null ? null : label.trim();
    }

    /**
     * 获取元数据英文名称
     *
     * @return ename - 元数据英文名称
     */
    public String getEname() {
        return ename;
    }

    /**
     * 设置元数据英文名称
     *
     * @param ename 元数据英文名称
     */
    public void setEname(String ename) {
        this.ename = ename == null ? null : ename.trim();
    }

    /**
     * @return placeholder
     */
    public String getPlaceholder() {
        return placeholder;
    }

    /**
     * @param placeholder
     */
    public void setPlaceholder(String placeholder) {
        this.placeholder = placeholder == null ? null : placeholder.trim();
    }

    /**
     * 获取元数据选项
     *
     * @return options - 元数据选项
     */
    public String getOptions() {
        return options;
    }

    /**
     * 设置元数据选项
     *
     * @param options 元数据选项
     */
    public void setOptions(String options) {
        this.options = options == null ? null : options.trim();
    }

    /**
     * 获取验证规则
     *
     * @return validate_rules - 验证规则
     */
    public String getValidateRules() {
        return validateRules;
    }

    /**
     * 设置验证规则
     *
     * @param validateRules 验证规则
     */
    public void setValidateRules(String validateRules) {
        this.validateRules = validateRules == null ? null : validateRules.trim();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Metadata other = (Metadata) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getLabel() == null ? other.getLabel() == null : this.getLabel().equals(other.getLabel()))
            && (this.getEname() == null ? other.getEname() == null : this.getEname().equals(other.getEname()))
            && (this.getPlaceholder() == null ? other.getPlaceholder() == null : this.getPlaceholder().equals(other.getPlaceholder()))
            && (this.getOptions() == null ? other.getOptions() == null : this.getOptions().equals(other.getOptions()))
            && (this.getValidateRules() == null ? other.getValidateRules() == null : this.getValidateRules().equals(other.getValidateRules()))
            && (this.getEnable() == null ? other.getEnable() == null : this.getEnable().equals(other.getEnable()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getLabel() == null) ? 0 : getLabel().hashCode());
        result = prime * result + ((getEname() == null) ? 0 : getEname().hashCode());
        result = prime * result + ((getPlaceholder() == null) ? 0 : getPlaceholder().hashCode());
        result = prime * result + ((getOptions() == null) ? 0 : getOptions().hashCode());
        result = prime * result + ((getValidateRules() == null) ? 0 : getValidateRules().hashCode());
        result = prime * result + ((getEnable() == null) ? 0 : getEnable().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", typeId=").append(typeId);
        sb.append(", type=").append(type);
        sb.append(", label=").append(label);
        sb.append(", ename=").append(ename);
        sb.append(", placeholder=").append(placeholder);
        sb.append(", options=").append(options);
        sb.append(", validateRules=").append(validateRules);

        sb.append("]");
        return sb.toString();
    }
}
